import { HTTP } from "../utils/http.js"

class ActModel extends HTTP {
  getDetail(act_id, _callback) {
    let data = {
      "activityId":act_id
    };
    this.request({
      url: "/act/detail",
      method:"POST",
      data: data,
      success: function (data) {
      
        _callback(data);
      }
    })
  }setView
  setView(act_id){
    let data = {
      "activityId": act_id
    };
    this.request({
      url: "/act/viewActivity",
      method: "POST",
      data: data,
      success: function (data) {
       
      }
    })
  }
  signUp(act_id,_callback) {
    //报名
    let data = {
      "activityId": act_id
    };
    this.request({
      url: "/act/signUpActivity",
      method: "POST",
      data: data,
      success: function (data) {
        _callback(data)
      }
    })
  }

  sign(act_id) {
    //签到
    let data = {
      "activityId": act_id
    };
    this.request({
      url: "/act/signActivity",
      method: "POST",
      data: data,
      success: function (data) {
      }
    })
  }


  getSignList(act_id,_callback) {
    //签到
    let data = {
      "activityId": act_id
    };
    this.request({
      url: "/act/getSignList",
      method: "POST",
      data: data,
      success: function (data) {
        _callback(data);
      }
    })
  }

  update(data, _callback) {
    //更新
    this.request({
      url: "/act/update",
      method: "POST",
      data: data,
      success: function (data) {
        _callback(data);
      }
    })
  }

  getAllActivis(pagenation,_callback){
    this.request({
      url: "/act/mainPage?pageSize=" + pagenation.pageSize + "&pageNum=" + pagenation.pageNum,
      success: function (data) {
        _callback(data)
      }
    })
  }

  participatedAct(pagenation, _callback) {
    this.request({
      url: "/act/myJoinPage?pageSize=" + pagenation.pageSize + "&pageNum=" + pagenation.pageNum,
      success: function (data) {
        _callback(data)
      }
    })
  }

  myInitiateAct(pagenation, _callback) {
    this.request({
      url: "/act/myBuildActivity?pageSize=" + pagenation.pageSize + "&pageNum=" + pagenation.pageNum,
      success: function (data) {
        _callback(data)
      }
    })
  }
}  

export { ActModel }